#pragma once

#include <map>
#include "Behaviour.h"
#include "State.h"

namespace game_engine { namespace library
{

// Forward declarations
class NCidle;
class NCwalking;

/*!
 * \class NetworkController
 * \brief 
 */
class NetworkController : public game_engine::components::Behaviour
{
///////////////////////////////////////////////////////////////////////////////
// Attribute definition
///////////////////////////////////////////////////////////////////////////////
private:
    string idleAnimationId;
    map<Direction,string> walkAnimationId;
    FLOAT32 walkSpeed;
    NCidle *idleState;
    NCwalking *walkingState;
    Direction direction;
    BOOL directionUpdated;

///////////////////////////////////////////////////////////////////////////////
// Method definition
///////////////////////////////////////////////////////////////////////////////
public:
    // Constructors and Destructors
    NetworkController(void);
    NetworkController(GameObject *obj);
    virtual ~NetworkController(void);

    // Others
    void initialize(void) throw(...);

    // Getters
    const string& getIdleAnimationId(void) const;
    const string getWalkAnimationId(const Direction direction) const;
    const FLOAT32 getWalkSpeed(void) const;
    const Direction getDirection(void) const;
    const BOOL getDirectionUpdated(void) const;

    // Setters
    void setIdleAnimationId(const string &animId);
    void setWalkAnimationId(const Direction direction, const string &animId);
    void setWalkSpeed(const FLOAT32 speed);
    void setDirection(Direction dir);
    void setDirectionUpdated(const BOOL flag);

};

/*!
 * \class NCidle
 * \brief 
 */
class NCidle : public game_engine::components::State
{
///////////////////////////////////////////////////////////////////////////////
// Attribute definition
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
// Method definition
///////////////////////////////////////////////////////////////////////////////
public:
    // Constructors and Destructors
    NCidle(void);
    NCidle(game_engine::components::Behaviour *parent);
    virtual ~NCidle(void);

    // Others
    void onEnter(void) throw(...);
    void onLoop(const FLOAT32 time) throw(...);

};

/*!
 * \class NCwalking
 * \brief 
 */
class NCwalking : public game_engine::components::State
{
///////////////////////////////////////////////////////////////////////////////
// Attribute definition
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
// Method definition
///////////////////////////////////////////////////////////////////////////////
public:
    // Constructors and Destructors
    NCwalking(void);
    NCwalking(game_engine::components::Behaviour *parent);
    virtual ~NCwalking(void);

    // Others
    void onEnter(void) throw(...);
    void onLoop(const FLOAT32 time) throw(...);

private:
    void setDirectionSequence(const Direction direction) throw(...);
    void setNewPosition(const Direction direction, const FLOAT32 time) throw(...);

};

}}
